@model IEnumerable<University.Models.Group>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            Name
        </th>
        <th>
            Type
        </th>
        <th>
            Language
        </th>
        <th>
            YearStart
        </th>
        <th>
            YearEnd
        </th>
        <th>
            Domain
        </th>
        <th>
            Users
        </th>
        <th>
            Schedules
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.GroupId }) |
            @Html.ActionLink("Details", "Details", new { id=item.GroupId }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.GroupId })
        </td>
        <td>
			@item.Name
        </td>
        <td>
			@item.Type
        </td>
        <td>
			@item.Language
        </td>
        <td>
			@String.Format("{0:g}", item.YearStart)
        </td>
        <td>
			@String.Format("{0:g}", item.YearEnd)
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.Domain).ToString()
        </td>
        <td>
			@(item.Users == null ? "None" : item.Users.Count.ToString())
        </td>
        <td>
			@(item.Schedules == null ? "None" : item.Schedules.Count.ToString())
        </td>
    </tr>
}

</table>


